import xmlrpclib

SERVER = "http://localhost:8000"

s = xmlrpclib.Server(SERVER)

# create a queue
q = s.create_queue("firstQ")
print "Queue firstQ created"

# create another queue
q = s.create_queue("secondQ")
print "Queue secondQ created"

# create another queue with limited length
q = s.create_queue("thirdQ", 2)
print "Queue thirdQ created"

# list queues
print "Existing queues: %s" % s.list_queues()

# destroy queue
s.delete_queue("secondQ")
print "Queue secondQ destroyed"

# list queues
print "Existing queues: %s" % s.list_queues()

print

# Checing size
print "checking size of thirdQ..."
print "thirdQ has %s items queued" % s.qsize("thirdQ")

# empty and full
print "is thirdQ empty? %s" % s.empty("thirdQ") 
print "is thirdQ full? %s" % s.full("thirdQ") 

print

# adding an item
print "Adding item to thirdQ..."
s.put("thirdQ", "just some text")

print

# empty and full
print "is thirdQ empty? %s" % s.empty("thirdQ") 
print "is thirdQ full? %s" % s.full("thirdQ") 

print 

# adding another item
print "Adding another item to thirdQ..."
s.put("thirdQ", "just some other text")

print

# empty and full
print "is thirdQ empty? %s" % s.empty("thirdQ") 
print "is thirdQ full? %s" % s.full("thirdQ") 

